package com.yl.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.yl.dao.IAddressDao;
import com.yl.model.Address;
@Service
public class AddressService implements IAddressService {

	@Resource
	private IAddressDao addressDao;
	
	/**
	 *查询所有地址 
	 */
	@Override
	public Map findAll() {
		List<Address> list = addressDao.findAll();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("code", 0);
		map.put("msg", "查询成功");
		map.put("count", list.size());
		map.put("data", list);
		return map;
	}

	/**
	 *根据id删除地址
	 */
	@Override
	public int del(int address_id) {
		return addressDao.del(address_id);
	}

	/**
	 * 添加地址
	 */
	@Override
	public int add(Address address) {
		return addressDao.add(address);
	}

}
